﻿<Window x:Class="XamlHelpmeet.UI.FieldsListWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:model="clr-namespace:XamlHelpmeet.Model;assembly=XamlHelpmeet.Model"
        Width="450"
        Height="300"
        Loaded="Window_Loaded"
        ShowInTaskbar="True">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="75" />
        </Grid.ColumnDefinitions>
        <TextBlock Grid.ColumnSpan="2"
                   Margin="5"
                   VerticalAlignment="Top"
                   FontSize="11"
                   Foreground="DarkGray"
                   Text="Controls to Create When Field is Dragged to XAML Editor" />
        <StackPanel Grid.Row="1"
                    Grid.Column="0"
                    Orientation="Horizontal">
            <StackPanel.Resources>
                <Style TargetType="{x:Type RadioButton}">
                    <Setter Property="Margin" Value="7" />
                </Style>
            </StackPanel.Resources>
            <RadioButton x:Name="rdoLabelAndControl"
                         Content="Label &amp; Control"
                         IsChecked="True" />
            <RadioButton x:Name="rdoControlOnly"
                         Content="Control" />
            <RadioButton x:Name="rdoLabelOnly"
                         Content="Label" />
        </StackPanel>
        <Button Grid.Row="1"
                Grid.Column="1"
                Width="60"
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                Click="btnCollapseExpand_click"
                Content="Collapse" />

        <ListBox x:Name="lbFields"
                 Grid.Row="2"
                 Grid.Column="0"
                 Grid.ColumnSpan="2"
                 Margin="5"
                 HorizontalAlignment="Stretch"
                 HorizontalContentAlignment="Stretch"
                 AlternationCount="2">
            <ListBox.Resources>
                <Style TargetType="{x:Type ListBoxItem}">
                    <Style.Resources>
                        <!--  this is where the default colors for the ListBox SelectedItem are changed  -->
                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
                                         Color="LightGray" />
                        <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}"
                                         Color="Transparent" />
                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}"
                                         Color="{x:Static SystemColors.ControlTextColor}" />
                    </Style.Resources>
                    <Style.Triggers>
                        <Trigger Property="ListBox.AlternationIndex" Value="1">
                            <Setter Property="Background" Value="WhiteSmoke" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </ListBox.Resources>
            <ListBox.ItemTemplate>
                <DataTemplate DataType="model:PropertyInformation">
                    <Grid Margin="10,5,10,5">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="75" />
                        </Grid.ColumnDefinitions>
                        <TextBlock HorizontalAlignment="Left"
                                   VerticalAlignment="Center"
                                   MouseDown="TextBlockDrag_MouseDown"
                                   MouseMove="TextBlockDrag_MouseMove"
                                   Text="{Binding Path=FullName}"
                                   ToolTip="{Binding Path=NameSpaceTypeName}" />
                        <CheckBox Grid.Column="1"
                                  Margin="5,0,5,0"
                                  VerticalAlignment="Center"
                                  Content="Incl. Grid"
                                  IsChecked="{Binding Path=FieldListIncludeGridAttachedProperties,
                                                      Mode=TwoWay}"
                                  ToolTip="Check to include Grid.Column and Grid.Row properties in created controls." />
                        <ComboBox Grid.Column="2"
                                  Width="Auto"
                                  VerticalAlignment="Center"
                                  Focusable="False"
                                  FontSize="10"
                                  IsSynchronizedWithCurrentItem="True"
                                  Loaded="cboControlType_Loaded"
                                  SelectedItem="{Binding Path=(model:PropertyInformation.FieldListControlType), Mode=TwoWay}" />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</Window>
